@echo off
cls

SET PLATFORM=%1
SET CONFIG=%2
SET OUTPUTDIR=..\Deploy
SET SEVENZIPPATH=..\bin\7za.exe

IF "%PLATFORM%"=="" GOTO ErrorNoParams
IF "%CONFIG%"=="" GOTO ErrorNoParams

IF "%CONFIG%"=="DebugDeploy" SET REALCONFIG=Debug
IF "%CONFIG%"=="ReleaseDeploy" SET REALCONFIG=Release

SET TARGET=WaveAccess.LZONet.%PLATFORM%.%REALCONFIG%
SET INPUTDIR=..\WaveAccess.LZONet\bin\%CONFIG%\%PLATFORM%

IF NOT EXIST %OUTPUTDIR% MD %OUTPUTDIR%

SET OUTPUTPATH=%OUTPUTDIR%\%TARGET%.7z

IF EXIST %OUTPUTPATH% DEL %OUTPUTPATH%

TITLE Deploing %OUTPUTPATH%...

IF NOT EXIST %SEVENZIPPATH% GOTO ErrorNo7Zip

%SEVENZIPPATH% a -t7z %OUTPUTPATH% %INPUTDIR%\%TARGET%.dll
%SEVENZIPPATH% a -t7z %OUTPUTPATH% %INPUTDIR%\%TARGET%.xml
IF "%CONFIG%"=="DebugDeploy" %SEVENZIPPATH% a -t7z %OUTPUTPATH% %INPUTDIR%\%TARGET%.pdb

GOTO Exit

:ErrorNoParams
echo Not enough parameters.
EXIT 1

:ErrorNo7Zip
echo Can't find 7zip.
EXIT 2

:Exit
echo.
echo File %OUTPUTPATH% created.